package com.fx.zmlzml.domain.vo;

import com.fx.zmlzml.domain.dto.PcDTO;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
public class PcVO {

    /**
     * 主板
     */
    private String pcMotherboard;
    private String pcMotherboardModel;
    private BigDecimal pcMotherboardPrice;

    /**
     * CPU
     */
    private String pcCpu;
    private String pcCpuModel;
    private BigDecimal pcCpuPrice;

    /**
     * 散热器
     */
    private String pcCooler;
    private String pcCoolerModel;
    private BigDecimal pcCoolerPrice;

    /**
     * 显卡
     */
    private String pcGpu;
    private String pcGpuModel;
    private BigDecimal pcGpuPrice;

    /**
     * 内存
     */
    private String pcMemory;
    private String pcMemoryModel;
    private BigDecimal pcMemoryPrice;

    /**
     * 硬盘
     */
    private String pcHardDisk;
    private String pcHardDiskModel;
    private BigDecimal pcHardDiskPrice;

    /**
     * 电源
     */
    private String pcPowerSupply;
    private String pcPowerSupplyModel;
    private BigDecimal pcPowerSupplyPrice;

    /**
     * 机箱
     */
    private String pcCase;
    private String pcCaseModel;
    private BigDecimal pcCasePrice;

    public PcVO convertPcVO(PcDTO pcDTO) {
        PcVO pcVO = new PcVO();
        pcVO.setPcMotherboard(pcDTO.getPcMotherboard().getModel());
        pcVO.setPcCpu(pcDTO.getPcCpu().getModel());
        pcVO.setPcCooler(pcDTO.getPcCooler().getModel());
        pcVO.setPcGpu(pcDTO.getPcGpu().getModel());
        pcVO.setPcMemory(pcDTO.getPcMemory().getModel());
        pcVO.setPcHardDisk(pcDTO.getPcHardDisk().getModel());
        pcVO.setPcPowerSupply(pcDTO.getPcPowerSupply().getModel());
        pcVO.setPcCase(pcDTO.getPcCase().getModel());
        pcVO.setPcMotherboardModel(pcDTO.getPcMotherboard().getModel());
        pcVO.setPcCpuModel(pcDTO.getPcCpu().getModel());
        pcVO.setPcCoolerModel(pcDTO.getPcCooler().getModel());
        pcVO.setPcGpuModel(pcDTO.getPcGpu().getModel());
        pcVO.setPcMemoryModel(pcDTO.getPcMemory().getModel());
        pcVO.setPcHardDiskModel(pcDTO.getPcHardDisk().getModel());
        pcVO.setPcPowerSupplyModel(pcDTO.getPcPowerSupply().getModel());
        pcVO.setPcCaseModel(pcDTO.getPcCase().getModel());
        pcVO.setPcMotherboardPrice(pcDTO.getPcMotherboard().getPrice());
        pcVO.setPcCpuPrice(pcDTO.getPcCpu().getPrice());
        pcVO.setPcCoolerPrice(pcDTO.getPcCooler().getPrice());
        pcVO.setPcGpuPrice(pcDTO.getPcGpu().getPrice());
        pcVO.setPcMemoryPrice(pcDTO.getPcMemory().getPrice());
        pcVO.setPcHardDiskPrice(pcDTO.getPcHardDisk().getPrice());
        pcVO.setPcPowerSupplyPrice(pcDTO.getPcPowerSupply().getPrice());
        pcVO.setPcCasePrice(pcDTO.getPcCase().getPrice());
        return pcVO;
    }

    public List<PcVO> convertPcVOList(List<PcDTO> pcDTOList) {
        List<PcVO> pcVOList = new ArrayList<>();
        for (PcDTO pcDTO : pcDTOList) {
            pcVOList.add(convertPcVO(pcDTO));
        }
        return pcVOList;
    }

}
